<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<div id="app">
			<cpn></cpn>
			<cpn></cpn>
			<cpn></cpn>
		</div>
		<template id="cpn">
			<div id="">
				<h2>当前计数：{{counter}}</h2>
				<button type="button" @click="increment">+</button>
				<button type="button" @click="decrement">-</button>
			</div>
		</template>
		<script src="../js/vue.js"></script>
		<script>
			//1.注册组件
			Vue.component('cpn',{
				template:'#cpn',
				data(){
					return{
						counter:0
					}
				},
				methods:{
					increment(){
						this.counter++
					},
					decrement(){
						this.counter--
					}
				}
			})
			
			const app=new Vue({
				el:'#app',
				data:{
					message:'你好'
				}
			})
		</script>
	</body>
</html>
